#include <iostream>
using namespace std;
#define int long long
const int N = 150;
int a[N][N];
signed main() {
    int n;
    cin >> n;
    int ret = -0x3f3f3f3f;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++)
        {
            int temp;
            cin >> temp;
            a[i][j] = a[i - 1][j] + a[i][j - 1] + temp - a[i - 1][j - 1];
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            for(int x = i; x <= n; x++) {
                for(int y = j; y <= n; y++) {
                    int temp = a[x][y] - a[i - 1][y] - a[x][j - 1] + a[i - 1][j - 1];
                    ret = max(temp, ret);
                }
            }
        }
    }
    cout << ret << endl;

    return 0;
}